﻿/** 铁钩船长

  By setycyas @2023-03-06
*/

/* 全局设定
*/
#Include "..\Class\MyFuns.2.ahk"
#Include "..\Class\OrderMap.2.ahk"
#Include "..\Class\FaceDetector.2.ahk"
#Include "..\Class\CommonMacro.2.ahk"
#Include "..\Class\CommonUI.2.ahk"
#Include "..\Class\MyEmu.2.ahk"

#Warn
#MaxThreadsPerHotkey 1
SetWorkingDir(A_ScriptDir)
SendMode("Input")
;SendMode("Event")

/* 制作铁钩船长的宏类
*/
class HookMacro extends CommonMacro {

  /* 新增的宏函数
  */
  _AB(key){
    this._down(2)
    ;sleep(20)
    this._down(1)
    sleep(60)
    this._up(1)
    sleep(20)
    this._up(2)
  }
  _空中冲刺15(key){ ;角色15
    this._down(2)
    sleep(80)
    this._up(2)
    sleep(580)
    ;sleep(this.testParams[1])
    ;if (!GetKeyState(thisKey, "P")){
    ;  return
    ;}
    this._down(1)
    this._down(2)
    sleep(120)
    this._up(2)
    this._up(1)
  }
  _空中冲刺234(key){ ;角色234
    this._down(2)
    sleep(80)
    this._up(2)
    sleep(515) ;530对234角色有效,但500对4更好
    ;sleep(this.testParams[1])
    this._down(1)
    this._down(2)
    sleep(120)
    this._up(2)
    this._up(1)
  }

  /* 重载宏接口
  */
  _setMacro(){
    this.macroMap := OrderMap()
    this.macroMap["前A"] := ObjBindMethod(this, "_前A")
    this.macroMap["AB"] := ObjBindMethod(this, "_AB")
    this.macroMap["空中冲刺15"] := ObjBindMethod(this, "_空中冲刺15")
    this.macroMap["空中冲刺234"] := ObjBindMethod(this, "_空中冲刺234")
    this.macroArr := this.macroMap.getKeys()
  }

}

/* 运行当前脚本
*/
if (A_ScriptName == "铁钩船长.2.ahk") {
  face := FaceDetector() ;方向检测对象
  macro := HookMacro(face, ["e","f"]) ;宏对象,有界面时第二个参数可以随便写但长度不要小于2
  ;宏方案预设,用于菜单
  preset := Map(
    "角色15", ["AB", "前A", "空中冲刺15"],
    "角色234", ["AB", "前A", "空中冲刺234"]
  )
  ;新建界面并设定
  ui := CommonUI("铁钩船长", macro ,preset)
  ui.setup()
  ui._exeComboBox.Choose(MyEmu.FBA64)
  ui._gameKeyEdit.Text := "e,f"
  ui._hotkeyEdit.Text := "space,s,g"
  ui._fpsEdit.Text := 4
  ui._testEdit.Text := "580,50,150"
  ui.readPresetMenu("角色234")
}